package com.hehe.Config;


import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private AuthInterceptor authInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/",
                        "/login",
                        "/register",
                        "/about",
                        "/login/verification",
                        "/login/logout",
                        "/article/**",
                        "/static/**",
                        "/css/**",
                        "/js/**",
                        "/upload/**",
                        "/api/public/**",
                        "/api/**",
                        "/post/**",
                        "/secret/**"
                );
    }
}


